package com.yuexun.beilunpatient.ui.registration.adapter;

import android.widget.AbsListView;

import com.yuexun.beilunpatient.R;
import com.yuexun.beilunpatient.ui.registration.bean.AppointmentHistoryData;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by chenss on 2018/10/18.
 */
public class RegistrationListAdapter extends KJAdapter<AppointmentHistoryData> {

    public RegistrationListAdapter(AbsListView view, Collection<AppointmentHistoryData> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, AppointmentHistoryData item, boolean isScrolling, int position) {
        super.convert(helper, item, isScrolling, position);
        helper.setText(R.id.dep_name, item.getDepartment_name());
        helper.setText(R.id.doc_name, item.getDoctor_name());
        if(item.getRes_type().equals("2")){
            helper.setText(R.id.tv_state, "未支付");
        }else if(item.getRes_type().equals("3")){
            helper.setText(R.id.tv_state, "未成功");
        }else if(item.getRes_type().equals("4")){
            helper.setText(R.id.tv_state, "已退号");
        }else if(item.getRes_type().equals("5")){
            helper.setText(R.id.tv_state, "已完成");
        }
        helper.setText(R.id.hos_name, "(" + item.getHospital_name() + ")");
        if(item.getOut_time().equals("A")){
            helper.setText(R.id.schedule_date, item.getSchedule_date() + " 上午 " + item.getReg_num() + "号");
        }else if(item.getOut_time().equals("P")){
            helper.setText(R.id.schedule_date, item.getSchedule_date() + " 下午 " + item.getReg_num() + "号");
        }else if(item.getOut_time().equals("F")){
            helper.setText(R.id.schedule_date, item.getSchedule_date() + " 全天 " + item.getReg_num() + "号");
        }else if(item.getOut_time().equals("N")){
            helper.setText(R.id.schedule_date, item.getSchedule_date() + " 夜间 " + item.getReg_num() + "号");
        }
//        helper.setText(R.id.clinic_fee, "¥" + item.getClinic_fee());
    }
}
